<%@ include file="../common/top.jsp"%>

<div id="Catalog">
    new order


        <form action="updateOrder" method="post">
            <c:if test="${sessionScope.orderMsg != null}">
                <td colspan="8"><b>${sessionScope.orderMsg}</b></td>
            </c:if>
            <%
                String orderMsg="";
                session.setAttribute("orderMsg", orderMsg);
            %>

            <table>
                <tr>
                    <th><b>Item ID</b></th>
                    <th><b>Product ID</b></th>
                    <th><b>Description</b></th>
                    <th><b>In Stock?</b></th>
                    <th><b>Quantity</b></th>
                    <th><b>List Price</b></th>
                    <th><b>Total Cost</b></th>

                    <th>&nbsp;</th>
                </tr>

                <c:if test="${sessionScope.cart.numberOfItems == 0}">
                    <tr>
                        <td colspan="8"><b>Your cart is empty.</b></td>
                    </tr>
                </c:if>

                <c:if test="${sessionScope.cartMsg != null}">
                    <tr>
                        <td colspan="8"><b>${sessionScope.cartMsg}</b></td>
                        <%
                            String cartMsg= (String) session.getAttribute("cartMsg");
                            cartMsg = null;
                            session.setAttribute("cartMsg", cartMsg);
                        %>
                    </tr>
                </c:if>

                <c:forEach var="cartItem" items="${sessionScope.cart.cartItems}">
                    <tr>
                        <td>
                            <a href="itemForm?itemId=${cartItem.item.itemId}">${cartItem.item.itemId}</a>

                        </td>
                        <td>${cartItem.item.product.productId}</td>
                        <td>${cartItem.item.attribute1} ${cartItem.item.attribute2}
                                ${cartItem.item.attribute3} ${cartItem.item.attribute4}
                                ${cartItem.item.attribute5} ${cartItem.item.product.name}</td>
                        <td>${cartItem.inStock}</td>
                        <td>
                            <input type="text" name="${cartItem.item.itemId}" value="${cartItem.quantity}">
                        </td>
                        <td><fmt:formatNumber value="${cartItem.item.listPrice}"
                                              pattern="$#,##0.00" /></td>
                        <td><fmt:formatNumber value="${cartItem.total}"
                                              pattern="$#,##0.00" /></td>
                        <td>
                            <a href="itemForm?itemId=${cartItem.item.itemId}">${cartItem.item.itemId}</a>

                        </td>

                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="7">
                        Sub Total: <fmt:formatNumber
                            value="${sessionScope.cart.subTotal}" pattern="$#,##0.00" />
                    </td>
                    <td>&nbsp;</td>
                </tr>




                <tr>
                    <td colspan="8">
                        YOU ADDRESS FOR EACH PRODUCT:
                        <input type="radio" name="address" value="${sessionScope.loginAccount.address1}">${sessionScope.loginAccount.address1}
                        <input type="radio" name="address" value="${sessionScope.loginAccount.address2}">${sessionScope.loginAccount.address2}
<%--                        <input type="submit" name="update" value="Update And Save My Order">--%>
                        <input type="submit" name="save" value="Pay Off My Order">
                    </td>
                </tr>



            </table>
        </form>
</div>



<%@ include file="../common/bottom.jsp"%>